package com.dequan.springaiproject.controller;


import com.dequan.springaiproject.constant.PromptConstant;
import com.dequan.springaiproject.entity.Movie;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/structured")
public class StructuredController {

    @Autowired
    ChatClient chatClient;

    @RequestMapping("/chat/movie")
    public String chatMovie (@RequestParam String topic) {

        Movie recommendMovie = chatClient.prompt()
                .system(PromptConstant.MOVIE_RECOMMENDER_PROMPT)
                .user(topic)
                .call()
                .entity(Movie.class);


        return null;

    }
}
